home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / reviewed / volume01 / GNU_bc / patch01 < prev    next >
Encoding:
Internet Message Format  |  1992-03-03  |  44.0 KB

  1. From: Phil Nelson <phil@cs.wwu.edu>
  2. Subject:  v01i069:  GNU_bc - numeric processing language, Patch01
  3. Newsgroups: comp.sources.reviewed
  4. Approved: csr@calvin.dgbt.doc.ca
  5.  
  6. Submitted-by: Phil Nelson <phil@cs.wwu.edu>
  7. Posting-number: Volume 1, Issue 69
  8. Archive-name: GNU_bc/patch01
  9. Patch-To: GNU_bc: Volume 1, Issue 41-48
  10.  
  11. Here is patch 1 for GNU_bc.  This patch brings GNU_bc to version 1.02.
  12.  
  13. This is patch contains mainly bug fixes.  It is recommended that people
  14. use the supplied flex scanner.  (Via "make derived" before the full
  15. make.) The most recent version of flex has a bug that hangs the scanner
  16. if the NUL character is input.
  17.  
  18. For a complete list of changes, see the ChangeLog after applying the
  19. patch.
  20.  
  21.  
  22.  
  23. diff -c2 -r 1.01/ChangeLog 1.02/ChangeLog
  24. *** 1.01/ChangeLog    Thu Feb  6 16:45:19 1992
  25. --- 1.02/ChangeLog    Tue Mar  3 10:29:20 1992
  26. ***************
  27. *** 1,2 ****
  28. --- 1,68 ----
  29. + Tue Mar  3 10:16:07 1992  Phil Nelson  (phil at cs.wwu.edu)
  30. +     * (main.c) Added missing } at line 140.
  31. +     * (version.h) Changed date of version 1.02 to March 3, 1992.
  32. + Mon Feb  3 16:07:57 1992  Phil Nelson  (phil at cs.wwu.edu)
  33. +     * (version.h) Updated version number and date.
  34. +     * (bc.1) Added a new "VERSION" section.
  35. + Wed Jan 29 14:13:55 1992  Phil Nelson  (phil at cs.wwu.edu)
  36. +     * (execute.c) Removed the setjmp and longjmp calls that may have
  37. +       caused some problems with interrupted programs.
  38. + Thu Jan 16 17:08:16 1992  Phil Nelson  (phil at cs.wwu.edu)
  39. +     * (Makefile) Changed install to install the manual.
  40. + Wed Jan  8 13:23:42 1992  Phil Nelson  (phil at cs.wwu.edu)
  41. +     * Change all copyright notices to include 1992.
  42. +     
  43. +     * (load.c) Added termination to "load_code" to ignore code
  44. +       after an error has been found.
  45. +     * (scan.l) Changed the check for NUL characters in STRING tokens
  46. +       (before the close quote) to work correctly.  Also added code to
  47. +       report illegal characters in a more readable output format.
  48. +     * (bc.1) Added the exclusion of NUL characters from strings in
  49. +       the "differences" section and updated date of last change.
  50. +     * (const.h) Changed BC_MAX_SEGS to 16.
  51. + Mon Jan  6 14:20:02 1992  Phil Nelson  (phil at cs.wwu.edu)
  52. +     * (number.c) Changed the out_num routine to use a correct field
  53. +       size for bases greater than 16.  e.g.  For base 1000, each
  54. +       "digit" is a three digit number.
  55. +     * (Makefile) Added the "8" flag to get an 8 bit scanner.
  56. +     * (scan.l) Changed "char *" to "unsigned char *" to match the
  57. +       declaration of yytext for the 8 bit scanner.  Also added code
  58. +       to detect the null character in strings and generate an error.
  59. + Sat Jan  4 20:32:20 1992  Phil Nelson  (phil at cs.wwu.edu)
  60. +     * (const.h) Changed BC_BASE_MAX to INT_MAX to allow more bases!
  61. + Mon Dec 30 21:47:28 1991  Phil Nelson  (phil at cs.wwu.edu)
  62. +     * (main.c) Fixed the bug that loaded the math library before
  63. +       every file.
  64. +     * (bc.y) Removed some type declarations that duplicated token
  65. +       definitions so it could be run through bison.
  66. +     * (load.c) Added a check for maximum code size.
  67. +     * (Makefile) Added a prefix for LIBDIR and BINDIR so it can be
  68. +       changed easily.
  69.   Mon Nov 25 13:11:17 1991  Phil Nelson  (phil at cs.wwu.edu)
  70.   
  71. Common subdirectories: 1.01/Examples and 1.02/Examples
  72. diff -c2 -r 1.01/MANIFEST 1.02/MANIFEST
  73. *** 1.01/MANIFEST    Thu Feb  6 16:45:20 1992
  74. --- 1.02/MANIFEST    Tue Mar  3 10:29:22 1992
  75. ***************
  76. *** 45,49 ****
  77.    sbc.y                      2    
  78.    scan.c.dist                6    
  79. !  scan.l                     1    
  80.    storage.c                  4    
  81.    util.c                     3    
  82. --- 45,49 ----
  83.    sbc.y                      2    
  84.    scan.c.dist                6    
  85. !  scan.l                     2    
  86.    storage.c                  4    
  87.    util.c                     3    
  88. diff -c2 -r 1.01/Makefile 1.02/Makefile
  89. *** 1.01/Makefile    Thu Feb  6 16:45:21 1992
  90. --- 1.02/Makefile    Tue Mar  3 10:29:23 1992
  91. ***************
  92. *** 7,12 ****
  93.   #  LIBDIR and BINDIR are where bc and libmath.b will be put.
  94.   #
  95. ! LIBDIR = /usr/local/lib
  96. ! BINDIR = /usr/local/bin
  97.   #
  98.   #  INCLUDE is the directory from where header files are included.
  99. --- 7,14 ----
  100.   #  LIBDIR and BINDIR are where bc and libmath.b will be put.
  101.   #
  102. ! PREFIX = /usr/local
  103. ! LIBDIR = $(PREFIX)/lib
  104. ! BINDIR = $(PREFIX)/bin
  105. ! MANDIR = $(PREFIX)/man/man1
  106.   #
  107.   #  INCLUDE is the directory from where header files are included.
  108. ***************
  109. *** 23,27 ****
  110.   SHELL = /bin/sh
  111.   YACC = yacc
  112. ! LEX = flex -I
  113.   #LEX = lex
  114.   CC = cc
  115. --- 25,30 ----
  116.   SHELL = /bin/sh
  117.   YACC = yacc
  118. ! #YACC = bison -y
  119. ! LEX = flex -I8
  120.   #LEX = lex
  121.   CC = cc
  122. ***************
  123. *** 65,69 ****
  124.   
  125.   all: bc
  126. ! bc: config.h bc.$O $(OFILES) global.$O
  127.       $(CC) -o bc $(LDFLAGS) bc.$O $(OFILES) global.$O
  128.   
  129. --- 68,72 ----
  130.   
  131.   all: bc
  132. ! bc: $& config.h bc.$O $(OFILES) global.$O
  133.       $(CC) -o bc $(LDFLAGS) bc.$O $(OFILES) global.$O
  134.   
  135. ***************
  136. *** 91,94 ****
  137. --- 94,98 ----
  138.       if grep -s BC_MATH_FILE config.h; then rm -f $(LIBDIR)/libmath.b; \
  139.       cp libmath.b $(LIBDIR); chmod 444 $(LIBDIR)/libmath.b; else true; fi
  140. +     cp bc.1 $(MANDIR)
  141.   
  142.   dist: $(EXTRAFILES)
  143. Common subdirectories: 1.01/Test and 1.02/Test
  144. diff -c2 -r 1.01/bc.1 1.02/bc.1
  145. *** 1.01/bc.1    Thu Feb  6 16:45:40 1992
  146. --- 1.02/bc.1    Tue Mar  3 10:29:43 1992
  147. ***************
  148. *** 3,7 ****
  149.   .\"
  150.   .\" This file is part of bc written for MINIX.
  151. ! .\" Copyright (C) 1991 Free Software Foundation, Inc.
  152.   .\"
  153.   .\" This program is free software; you can redistribute it and/or modify
  154. --- 3,7 ----
  155.   .\"
  156.   .\" This file is part of bc written for MINIX.
  157. ! .\" Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  158.   .\"
  159.   .\" This program is free software; you can redistribute it and/or modify
  160. ***************
  161. *** 27,31 ****
  162.   .\"
  163.   .\"
  164. ! .TH bc 1 .\" "Command Manual" v1.01 "Nov 22, 1991"
  165.   .SH NAME
  166.   bc - An arbitrary precision calculator language
  167. --- 27,31 ----
  168.   .\"
  169.   .\"
  170. ! .TH bc 1 .\" "Command Manual" v1.02 "Feb 3, 1992"
  171.   .SH NAME
  172.   bc - An arbitrary precision calculator language
  173. ***************
  174. *** 32,35 ****
  175. --- 32,37 ----
  176.   .SH SYNTAX
  177.   \fBbc\fR [ \fB-lws\fR ] [ \fI file ...\fR ]
  178. + .SH VERSION
  179. + This man page documents GNU bc version 1.02.
  180.   .SH DESCRIPTION
  181.   \fBbc\fR is a language that supports arbitrary precision numbers
  182. ***************
  183. *** 589,593 ****
  184.   A major source of differences is
  185.   extensions, where a feature is extended to add more functionality and
  186. !  additions, where new features are added. 
  187.   The following is the list of differences and extensions.
  188.   .IP LANG environment
  189. --- 591,595 ----
  190.   A major source of differences is
  191.   extensions, where a feature is extended to add more functionality and
  192. ! additions, where new features are added. 
  193.   The following is the list of differences and extensions.
  194.   .IP LANG environment
  195. ***************
  196. *** 601,604 ****
  197. --- 603,609 ----
  198.   been extended to be multi-character names that start with a letter and
  199.   may contain letters, numbers and the underscore character.
  200. + .IP Strings
  201. + Strings are not allowed to contain NUL characters.  POSIX says all characters
  202. + must be included in strings.
  203.   .IP last
  204.   POSIX \fBbc\fR does not have a \fBlast\fR variable.  Some implementations
  205. ***************
  206. *** 661,664 ****
  207. --- 666,681 ----
  208.   of the current execution block.  A runtime warning will not terminate the
  209.   current execution block.
  210. + .IP "Interrupts"
  211. + During an interactive session, the SIGINT signal (usually generated by
  212. + the control-C character from the terminal) will cause execution of the
  213. + current execution block to be interrupted.  It will display a "runtime"
  214. + error indicating which function was interrupted.  After all runtime
  215. + structures have been cleaned up, a message will be printed to notify the
  216. + user that \fBbc\fR is ready for more input.  All previously defined functions
  217. + remain defined and the value of all non-auto variables are the value at
  218. + the point of interruption.  All auto variables and function parameters
  219. + are removed during the
  220. + clean up process.  During a non-interactive
  221. + session, the SIGINT signal will terminate the entire run of \fBbc\fR.
  222.   .SS LIMITS
  223.   The following are the limits currently in place for this 
  224. diff -c2 -r 1.01/bc.c.dist 1.02/bc.c.dist
  225. *** 1.01/bc.c.dist    Thu Feb  6 16:45:45 1992
  226. --- 1.02/bc.c.dist    Tue Mar  3 10:29:48 1992
  227. ***************
  228. *** 8,12 ****
  229.   
  230.   /*  This file is part of bc written for MINIX.
  231. !     Copyright (C) 1991 Free Software Foundation, Inc.
  232.   
  233.       This program is free software; you can redistribute it and/or modify
  234. --- 8,12 ----
  235.   
  236.   /*  This file is part of bc written for MINIX.
  237. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  238.   
  239.       This program is free software; you can redistribute it and/or modify
  240. ***************
  241. *** 685,689 ****
  242.       {
  243.   case 1:
  244. ! #line 108 "bc.y"
  245.   {
  246.                     yyval.i_value = 0;
  247. --- 685,689 ----
  248.       {
  249.   case 1:
  250. ! #line 106 "bc.y"
  251.   {
  252.                     yyval.i_value = 0;
  253. ***************
  254. *** 696,708 ****
  255.   break;
  256.   case 3:
  257. ! #line 119 "bc.y"
  258.   { run_code (); }
  259.   break;
  260.   case 4:
  261. ! #line 121 "bc.y"
  262.   { run_code (); }
  263.   break;
  264.   case 5:
  265. ! #line 123 "bc.y"
  266.   {
  267.                     yyerrok;
  268. --- 696,708 ----
  269.   break;
  270.   case 3:
  271. ! #line 117 "bc.y"
  272.   { run_code (); }
  273.   break;
  274.   case 4:
  275. ! #line 119 "bc.y"
  276.   { run_code (); }
  277.   break;
  278.   case 5:
  279. ! #line 121 "bc.y"
  280.   {
  281.                     yyerrok;
  282. ***************
  283. *** 711,735 ****
  284.   break;
  285.   case 6:
  286. ! #line 129 "bc.y"
  287.   { yyval.i_value = 0; }
  288.   break;
  289.   case 10:
  290. ! #line 135 "bc.y"
  291.   { yyval.i_value = 0; }
  292.   break;
  293.   case 17:
  294. ! #line 144 "bc.y"
  295.   { yyval.i_value = yyvsp[0].i_value; }
  296.   break;
  297.   case 18:
  298. ! #line 147 "bc.y"
  299.   { warranty (""); }
  300.   break;
  301.   case 19:
  302. ! #line 149 "bc.y"
  303.   { limits (); }
  304.   break;
  305.   case 20:
  306. ! #line 151 "bc.y"
  307.   {
  308.                     if (yyvsp[0].i_value & 2)
  309. --- 711,735 ----
  310.   break;
  311.   case 6:
  312. ! #line 127 "bc.y"
  313.   { yyval.i_value = 0; }
  314.   break;
  315.   case 10:
  316. ! #line 133 "bc.y"
  317.   { yyval.i_value = 0; }
  318.   break;
  319.   case 17:
  320. ! #line 142 "bc.y"
  321.   { yyval.i_value = yyvsp[0].i_value; }
  322.   break;
  323.   case 18:
  324. ! #line 145 "bc.y"
  325.   { warranty (""); }
  326.   break;
  327.   case 19:
  328. ! #line 147 "bc.y"
  329.   { limits (); }
  330.   break;
  331.   case 20:
  332. ! #line 149 "bc.y"
  333.   {
  334.                     if (yyvsp[0].i_value & 2)
  335. ***************
  336. *** 742,746 ****
  337.   break;
  338.   case 21:
  339. ! #line 160 "bc.y"
  340.   {
  341.                     yyval.i_value = 0;
  342. --- 742,746 ----
  343.   break;
  344.   case 21:
  345. ! #line 158 "bc.y"
  346.   {
  347.                     yyval.i_value = 0;
  348. ***************
  349. *** 751,755 ****
  350.   break;
  351.   case 22:
  352. ! #line 167 "bc.y"
  353.   {
  354.                     if (break_label == 0)
  355. --- 751,755 ----
  356.   break;
  357.   case 22:
  358. ! #line 165 "bc.y"
  359.   {
  360.                     if (break_label == 0)
  361. ***************
  362. *** 763,767 ****
  363.   break;
  364.   case 23:
  365. ! #line 177 "bc.y"
  366.   {
  367.                     warn ("Continue statement");
  368. --- 763,767 ----
  369.   break;
  370.   case 23:
  371. ! #line 175 "bc.y"
  372.   {
  373.                     warn ("Continue statement");
  374. ***************
  375. *** 776,796 ****
  376.   break;
  377.   case 24:
  378. ! #line 188 "bc.y"
  379.   { exit (0); }
  380.   break;
  381.   case 25:
  382. ! #line 190 "bc.y"
  383.   { generate ("h"); }
  384.   break;
  385.   case 26:
  386. ! #line 192 "bc.y"
  387.   { generate ("0R"); }
  388.   break;
  389.   case 27:
  390. ! #line 194 "bc.y"
  391.   { generate ("R"); }
  392.   break;
  393.   case 28:
  394. ! #line 196 "bc.y"
  395.   {
  396.                     yyvsp[0].i_value = break_label; 
  397. --- 776,796 ----
  398.   break;
  399.   case 24:
  400. ! #line 186 "bc.y"
  401.   { exit (0); }
  402.   break;
  403.   case 25:
  404. ! #line 188 "bc.y"
  405.   { generate ("h"); }
  406.   break;
  407.   case 26:
  408. ! #line 190 "bc.y"
  409.   { generate ("0R"); }
  410.   break;
  411.   case 27:
  412. ! #line 192 "bc.y"
  413.   { generate ("R"); }
  414.   break;
  415.   case 28:
  416. ! #line 194 "bc.y"
  417.   {
  418.                     yyvsp[0].i_value = break_label; 
  419. ***************
  420. *** 799,803 ****
  421.   break;
  422.   case 29:
  423. ! #line 201 "bc.y"
  424.   {
  425.                     if (yyvsp[-1].i_value > 1)
  426. --- 799,803 ----
  427.   break;
  428.   case 29:
  429. ! #line 199 "bc.y"
  430.   {
  431.                     if (yyvsp[-1].i_value > 1)
  432. ***************
  433. *** 812,816 ****
  434.   break;
  435.   case 30:
  436. ! #line 212 "bc.y"
  437.   {
  438.                     if (yyvsp[-1].i_value < 0) generate ("1");
  439. --- 812,816 ----
  440.   break;
  441.   case 30:
  442. ! #line 210 "bc.y"
  443.   {
  444.                     if (yyvsp[-1].i_value < 0) generate ("1");
  445. ***************
  446. *** 825,829 ****
  447.   break;
  448.   case 31:
  449. ! #line 223 "bc.y"
  450.   {
  451.                     if (yyvsp[-1].i_value > 1)
  452. --- 825,829 ----
  453.   break;
  454.   case 31:
  455. ! #line 221 "bc.y"
  456.   {
  457.                     if (yyvsp[-1].i_value > 1)
  458. ***************
  459. *** 837,841 ****
  460.   break;
  461.   case 32:
  462. ! #line 233 "bc.y"
  463.   {
  464.                     sprintf (genstr, "J%1d:N%1d:",
  465. --- 837,841 ----
  466.   break;
  467.   case 32:
  468. ! #line 231 "bc.y"
  469.   {
  470.                     sprintf (genstr, "J%1d:N%1d:",
  471. ***************
  472. *** 847,851 ****
  473.   break;
  474.   case 33:
  475. ! #line 241 "bc.y"
  476.   {
  477.                     yyvsp[-1].i_value = if_label;
  478. --- 847,851 ----
  479.   break;
  480.   case 33:
  481. ! #line 239 "bc.y"
  482.   {
  483.                     yyvsp[-1].i_value = if_label;
  484. ***************
  485. *** 856,860 ****
  486.   break;
  487.   case 34:
  488. ! #line 248 "bc.y"
  489.   {
  490.                     sprintf (genstr, "N%1d:", if_label); 
  491. --- 856,860 ----
  492.   break;
  493.   case 34:
  494. ! #line 246 "bc.y"
  495.   {
  496.                     sprintf (genstr, "N%1d:", if_label); 
  497. ***************
  498. *** 864,868 ****
  499.   break;
  500.   case 35:
  501. ! #line 254 "bc.y"
  502.   {
  503.                     yyvsp[0].i_value = next_label++;
  504. --- 864,868 ----
  505.   break;
  506.   case 35:
  507. ! #line 252 "bc.y"
  508.   {
  509.                     yyvsp[0].i_value = next_label++;
  510. ***************
  511. *** 872,876 ****
  512.   break;
  513.   case 36:
  514. ! #line 260 "bc.y"
  515.   {
  516.                     yyvsp[0].i_value = break_label; 
  517. --- 872,876 ----
  518.   break;
  519.   case 36:
  520. ! #line 258 "bc.y"
  521.   {
  522.                     yyvsp[0].i_value = break_label; 
  523. ***************
  524. *** 881,885 ****
  525.   break;
  526.   case 37:
  527. ! #line 267 "bc.y"
  528.   {
  529.                     sprintf (genstr, "J%1d:N%1d:", yyvsp[-6].i_value, break_label);
  530. --- 881,885 ----
  531.   break;
  532.   case 37:
  533. ! #line 265 "bc.y"
  534.   {
  535.                     sprintf (genstr, "J%1d:N%1d:", yyvsp[-6].i_value, break_label);
  536. ***************
  537. *** 889,901 ****
  538.   break;
  539.   case 38:
  540. ! #line 273 "bc.y"
  541.   { yyval.i_value = 0; }
  542.   break;
  543.   case 39:
  544. ! #line 275 "bc.y"
  545.   {  warn ("print statement"); }
  546.   break;
  547.   case 43:
  548. ! #line 282 "bc.y"
  549.   {
  550.                     generate ("O");
  551. --- 889,901 ----
  552.   break;
  553.   case 38:
  554. ! #line 271 "bc.y"
  555.   { yyval.i_value = 0; }
  556.   break;
  557.   case 39:
  558. ! #line 273 "bc.y"
  559.   {  warn ("print statement"); }
  560.   break;
  561.   case 43:
  562. ! #line 280 "bc.y"
  563.   {
  564.                     generate ("O");
  565. ***************
  566. *** 905,913 ****
  567.   break;
  568.   case 44:
  569. ! #line 288 "bc.y"
  570.   { generate ("P"); }
  571.   break;
  572.   case 46:
  573. ! #line 292 "bc.y"
  574.   {
  575.                     warn ("else clause in if statement");
  576. --- 905,913 ----
  577.   break;
  578.   case 44:
  579. ! #line 286 "bc.y"
  580.   { generate ("P"); }
  581.   break;
  582.   case 46:
  583. ! #line 290 "bc.y"
  584.   {
  585.                     warn ("else clause in if statement");
  586. ***************
  587. *** 919,923 ****
  588.   break;
  589.   case 48:
  590. ! #line 302 "bc.y"
  591.   {
  592.                     /* Check auto list against parameter list? */
  593. --- 919,923 ----
  594.   break;
  595.   case 48:
  596. ! #line 300 "bc.y"
  597.   {
  598.                     /* Check auto list against parameter list? */
  599. ***************
  600. *** 933,937 ****
  601.   break;
  602.   case 49:
  603. ! #line 314 "bc.y"
  604.   {
  605.                     generate ("0R]");
  606. --- 933,937 ----
  607.   break;
  608.   case 49:
  609. ! #line 312 "bc.y"
  610.   {
  611.                     generate ("0R]");
  612. ***************
  613. *** 940,980 ****
  614.   break;
  615.   case 50:
  616. ! #line 320 "bc.y"
  617.   { yyval.a_value = NULL; }
  618.   break;
  619.   case 52:
  620. ! #line 324 "bc.y"
  621.   { yyval.a_value = NULL; }
  622.   break;
  623.   case 53:
  624. ! #line 326 "bc.y"
  625.   { yyval.a_value = yyvsp[-1].a_value; }
  626.   break;
  627.   case 54:
  628. ! #line 328 "bc.y"
  629.   { yyval.a_value = yyvsp[-1].a_value; }
  630.   break;
  631.   case 55:
  632. ! #line 331 "bc.y"
  633.   { yyval.a_value = nextarg (NULL, lookup (yyvsp[0].s_value,SIMPLE)); }
  634.   break;
  635.   case 56:
  636. ! #line 333 "bc.y"
  637.   { yyval.a_value = nextarg (NULL, lookup (yyvsp[-2].s_value,ARRAY)); }
  638.   break;
  639.   case 57:
  640. ! #line 335 "bc.y"
  641.   { yyval.a_value = nextarg (yyvsp[-2].a_value, lookup (yyvsp[0].s_value,SIMPLE)); }
  642.   break;
  643.   case 58:
  644. ! #line 337 "bc.y"
  645.   { yyval.a_value = nextarg (yyvsp[-4].a_value, lookup (yyvsp[-2].s_value,ARRAY)); }
  646.   break;
  647.   case 59:
  648. ! #line 340 "bc.y"
  649.   { yyval.a_value = NULL; }
  650.   break;
  651.   case 61:
  652. ! #line 344 "bc.y"
  653.   {
  654.                     if (yyvsp[0].i_value > 1) warn ("comparison in argument");
  655. --- 940,980 ----
  656.   break;
  657.   case 50:
  658. ! #line 318 "bc.y"
  659.   { yyval.a_value = NULL; }
  660.   break;
  661.   case 52:
  662. ! #line 322 "bc.y"
  663.   { yyval.a_value = NULL; }
  664.   break;
  665.   case 53:
  666. ! #line 324 "bc.y"
  667.   { yyval.a_value = yyvsp[-1].a_value; }
  668.   break;
  669.   case 54:
  670. ! #line 326 "bc.y"
  671.   { yyval.a_value = yyvsp[-1].a_value; }
  672.   break;
  673.   case 55:
  674. ! #line 329 "bc.y"
  675.   { yyval.a_value = nextarg (NULL, lookup (yyvsp[0].s_value,SIMPLE)); }
  676.   break;
  677.   case 56:
  678. ! #line 331 "bc.y"
  679.   { yyval.a_value = nextarg (NULL, lookup (yyvsp[-2].s_value,ARRAY)); }
  680.   break;
  681.   case 57:
  682. ! #line 333 "bc.y"
  683.   { yyval.a_value = nextarg (yyvsp[-2].a_value, lookup (yyvsp[0].s_value,SIMPLE)); }
  684.   break;
  685.   case 58:
  686. ! #line 335 "bc.y"
  687.   { yyval.a_value = nextarg (yyvsp[-4].a_value, lookup (yyvsp[-2].s_value,ARRAY)); }
  688.   break;
  689.   case 59:
  690. ! #line 338 "bc.y"
  691.   { yyval.a_value = NULL; }
  692.   break;
  693.   case 61:
  694. ! #line 342 "bc.y"
  695.   {
  696.                     if (yyvsp[0].i_value > 1) warn ("comparison in argument");
  697. ***************
  698. *** 983,987 ****
  699.   break;
  700.   case 62:
  701. ! #line 349 "bc.y"
  702.   {
  703.                     sprintf (genstr, "K%d:", -lookup (yyvsp[-2].s_value,ARRAY));
  704. --- 983,987 ----
  705.   break;
  706.   case 62:
  707. ! #line 347 "bc.y"
  708.   {
  709.                     sprintf (genstr, "K%d:", -lookup (yyvsp[-2].s_value,ARRAY));
  710. ***************
  711. *** 991,995 ****
  712.   break;
  713.   case 63:
  714. ! #line 355 "bc.y"
  715.   {
  716.                     if (yyvsp[0].i_value > 1) warn ("comparison in argument");
  717. --- 991,995 ----
  718.   break;
  719.   case 63:
  720. ! #line 353 "bc.y"
  721.   {
  722.                     if (yyvsp[0].i_value > 1) warn ("comparison in argument");
  723. ***************
  724. *** 998,1002 ****
  725.   break;
  726.   case 64:
  727. ! #line 360 "bc.y"
  728.   {
  729.                     sprintf (genstr, "K%d:", -lookup (yyvsp[-2].s_value,ARRAY));
  730. --- 998,1002 ----
  731.   break;
  732.   case 64:
  733. ! #line 358 "bc.y"
  734.   {
  735.                     sprintf (genstr, "K%d:", -lookup (yyvsp[-2].s_value,ARRAY));
  736. ***************
  737. *** 1006,1010 ****
  738.   break;
  739.   case 65:
  740. ! #line 367 "bc.y"
  741.   {
  742.                     yyval.i_value = -1;
  743. --- 1006,1010 ----
  744.   break;
  745.   case 65:
  746. ! #line 365 "bc.y"
  747.   {
  748.                     yyval.i_value = -1;
  749. ***************
  750. *** 1013,1017 ****
  751.   break;
  752.   case 67:
  753. ! #line 374 "bc.y"
  754.   {
  755.                     yyval.i_value = 0;
  756. --- 1013,1017 ----
  757.   break;
  758.   case 67:
  759. ! #line 372 "bc.y"
  760.   {
  761.                     yyval.i_value = 0;
  762. ***************
  763. *** 1020,1024 ****
  764.   break;
  765.   case 68:
  766. ! #line 379 "bc.y"
  767.   {
  768.                     if (yyvsp[0].i_value > 1)
  769. --- 1020,1024 ----
  770.   break;
  771.   case 68:
  772. ! #line 377 "bc.y"
  773.   {
  774.                     if (yyvsp[0].i_value > 1)
  775. ***************
  776. *** 1027,1031 ****
  777.   break;
  778.   case 69:
  779. ! #line 385 "bc.y"
  780.   {
  781.                     if (yyvsp[0].c_value != '=')
  782. --- 1027,1031 ----
  783.   break;
  784.   case 69:
  785. ! #line 383 "bc.y"
  786.   {
  787.                     if (yyvsp[0].c_value != '=')
  788. ***************
  789. *** 1040,1044 ****
  790.   break;
  791.   case 70:
  792. ! #line 396 "bc.y"
  793.   {
  794.                     if (yyvsp[0].i_value > 1) warn("comparison in assignment");
  795. --- 1040,1044 ----
  796.   break;
  797.   case 70:
  798. ! #line 394 "bc.y"
  799.   {
  800.                     if (yyvsp[0].i_value > 1) warn("comparison in assignment");
  801. ***************
  802. *** 1057,1061 ****
  803.   break;
  804.   case 71:
  805. ! #line 412 "bc.y"
  806.   {
  807.                     warn("&& operator");
  808. --- 1057,1061 ----
  809.   break;
  810.   case 71:
  811. ! #line 410 "bc.y"
  812.   {
  813.                     warn("&& operator");
  814. ***************
  815. *** 1066,1070 ****
  816.   break;
  817.   case 72:
  818. ! #line 419 "bc.y"
  819.   {
  820.                     sprintf (genstr, "DZ%d:p1N%d:", yyvsp[-2].i_value, yyvsp[-2].i_value);
  821. --- 1066,1070 ----
  822.   break;
  823.   case 72:
  824. ! #line 417 "bc.y"
  825.   {
  826.                     sprintf (genstr, "DZ%d:p1N%d:", yyvsp[-2].i_value, yyvsp[-2].i_value);
  827. ***************
  828. *** 1074,1078 ****
  829.   break;
  830.   case 73:
  831. ! #line 425 "bc.y"
  832.   {
  833.                     warn("|| operator");
  834. --- 1074,1078 ----
  835.   break;
  836.   case 73:
  837. ! #line 423 "bc.y"
  838.   {
  839.                     warn("|| operator");
  840. ***************
  841. *** 1083,1087 ****
  842.   break;
  843.   case 74:
  844. ! #line 432 "bc.y"
  845.   {
  846.                     int tmplab;
  847. --- 1083,1087 ----
  848.   break;
  849.   case 74:
  850. ! #line 430 "bc.y"
  851.   {
  852.                     int tmplab;
  853. ***************
  854. *** 1094,1098 ****
  855.   break;
  856.   case 75:
  857. ! #line 441 "bc.y"
  858.   {
  859.                     yyval.i_value = yyvsp[0].i_value;
  860. --- 1094,1098 ----
  861.   break;
  862.   case 75:
  863. ! #line 439 "bc.y"
  864.   {
  865.                     yyval.i_value = yyvsp[0].i_value;
  866. ***************
  867. *** 1102,1106 ****
  868.   break;
  869.   case 76:
  870. ! #line 447 "bc.y"
  871.   {
  872.                     yyval.i_value = 3;
  873. --- 1102,1106 ----
  874.   break;
  875.   case 76:
  876. ! #line 445 "bc.y"
  877.   {
  878.                     yyval.i_value = 3;
  879. ***************
  880. *** 1132,1136 ****
  881.   break;
  882.   case 77:
  883. ! #line 475 "bc.y"
  884.   {
  885.                     generate ("+");
  886. --- 1132,1136 ----
  887.   break;
  888.   case 77:
  889. ! #line 473 "bc.y"
  890.   {
  891.                     generate ("+");
  892. ***************
  893. *** 1139,1143 ****
  894.   break;
  895.   case 78:
  896. ! #line 480 "bc.y"
  897.   {
  898.                     generate ("-");
  899. --- 1139,1143 ----
  900.   break;
  901.   case 78:
  902. ! #line 478 "bc.y"
  903.   {
  904.                     generate ("-");
  905. ***************
  906. *** 1146,1150 ****
  907.   break;
  908.   case 79:
  909. ! #line 485 "bc.y"
  910.   {
  911.                     genstr[0] = yyvsp[-1].c_value;
  912. --- 1146,1150 ----
  913.   break;
  914.   case 79:
  915. ! #line 483 "bc.y"
  916.   {
  917.                     genstr[0] = yyvsp[-1].c_value;
  918. ***************
  919. *** 1155,1159 ****
  920.   break;
  921.   case 80:
  922. ! #line 492 "bc.y"
  923.   {
  924.                     generate ("^");
  925. --- 1155,1159 ----
  926.   break;
  927.   case 80:
  928. ! #line 490 "bc.y"
  929.   {
  930.                     generate ("^");
  931. ***************
  932. *** 1162,1166 ****
  933.   break;
  934.   case 81:
  935. ! #line 497 "bc.y"
  936.   {
  937.                     generate ("n");
  938. --- 1162,1166 ----
  939.   break;
  940.   case 81:
  941. ! #line 495 "bc.y"
  942.   {
  943.                     generate ("n");
  944. ***************
  945. *** 1169,1173 ****
  946.   break;
  947.   case 82:
  948. ! #line 502 "bc.y"
  949.   {
  950.                     yyval.i_value = 1;
  951. --- 1169,1173 ----
  952.   break;
  953.   case 82:
  954. ! #line 500 "bc.y"
  955.   {
  956.                     yyval.i_value = 1;
  957. ***************
  958. *** 1180,1184 ****
  959.   break;
  960.   case 83:
  961. ! #line 511 "bc.y"
  962.   {
  963.                     int len = strlen(yyvsp[0].s_value);
  964. --- 1180,1184 ----
  965.   break;
  966.   case 83:
  967. ! #line 509 "bc.y"
  968.   {
  969.                     int len = strlen(yyvsp[0].s_value);
  970. ***************
  971. *** 1198,1206 ****
  972.   break;
  973.   case 84:
  974. ! #line 527 "bc.y"
  975.   { yyval.i_value = yyvsp[-1].i_value | 1; }
  976.   break;
  977.   case 85:
  978. ! #line 529 "bc.y"
  979.   {
  980.                     yyval.i_value = 1;
  981. --- 1198,1206 ----
  982.   break;
  983.   case 84:
  984. ! #line 525 "bc.y"
  985.   { yyval.i_value = yyvsp[-1].i_value | 1; }
  986.   break;
  987.   case 85:
  988. ! #line 527 "bc.y"
  989.   {
  990.                     yyval.i_value = 1;
  991. ***************
  992. *** 1220,1224 ****
  993.   break;
  994.   case 86:
  995. ! #line 545 "bc.y"
  996.   {
  997.                     yyval.i_value = 1;
  998. --- 1220,1224 ----
  999.   break;
  1000.   case 86:
  1001. ! #line 543 "bc.y"
  1002.   {
  1003.                     yyval.i_value = 1;
  1004. ***************
  1005. *** 1241,1245 ****
  1006.   break;
  1007.   case 87:
  1008. ! #line 564 "bc.y"
  1009.   {
  1010.                     yyval.i_value = 1;
  1011. --- 1241,1245 ----
  1012.   break;
  1013.   case 87:
  1014. ! #line 562 "bc.y"
  1015.   {
  1016.                     yyval.i_value = 1;
  1017. ***************
  1018. *** 1266,1282 ****
  1019.   break;
  1020.   case 88:
  1021. ! #line 587 "bc.y"
  1022.   { generate ("cL"); yyval.i_value = 1;}
  1023.   break;
  1024.   case 89:
  1025. ! #line 589 "bc.y"
  1026.   { generate ("cR"); yyval.i_value = 1;}
  1027.   break;
  1028.   case 90:
  1029. ! #line 591 "bc.y"
  1030.   { generate ("cS"); yyval.i_value = 1;}
  1031.   break;
  1032.   case 91:
  1033. ! #line 593 "bc.y"
  1034.   {
  1035.                     warn ("read function");
  1036. --- 1266,1282 ----
  1037.   break;
  1038.   case 88:
  1039. ! #line 585 "bc.y"
  1040.   { generate ("cL"); yyval.i_value = 1;}
  1041.   break;
  1042.   case 89:
  1043. ! #line 587 "bc.y"
  1044.   { generate ("cR"); yyval.i_value = 1;}
  1045.   break;
  1046.   case 90:
  1047. ! #line 589 "bc.y"
  1048.   { generate ("cS"); yyval.i_value = 1;}
  1049.   break;
  1050.   case 91:
  1051. ! #line 591 "bc.y"
  1052.   {
  1053.                     warn ("read function");
  1054. ***************
  1055. *** 1285,1293 ****
  1056.   break;
  1057.   case 92:
  1058. ! #line 599 "bc.y"
  1059.   { yyval.i_value = lookup(yyvsp[0].s_value,SIMPLE); }
  1060.   break;
  1061.   case 93:
  1062. ! #line 601 "bc.y"
  1063.   {
  1064.                     if (yyvsp[-1].i_value > 1) warn("comparison in subscript");
  1065. --- 1285,1293 ----
  1066.   break;
  1067.   case 92:
  1068. ! #line 597 "bc.y"
  1069.   { yyval.i_value = lookup(yyvsp[0].s_value,SIMPLE); }
  1070.   break;
  1071.   case 93:
  1072. ! #line 599 "bc.y"
  1073.   {
  1074.                     if (yyvsp[-1].i_value > 1) warn("comparison in subscript");
  1075. ***************
  1076. *** 1296,1312 ****
  1077.   break;
  1078.   case 94:
  1079. ! #line 606 "bc.y"
  1080.   { yyval.i_value = 0; }
  1081.   break;
  1082.   case 95:
  1083. ! #line 608 "bc.y"
  1084.   { yyval.i_value = 1; }
  1085.   break;
  1086.   case 96:
  1087. ! #line 610 "bc.y"
  1088.   { yyval.i_value = 2; }
  1089.   break;
  1090.   case 97:
  1091. ! #line 612 "bc.y"
  1092.   { yyval.i_value = 3; }
  1093.   break;
  1094. --- 1296,1312 ----
  1095.   break;
  1096.   case 94:
  1097. ! #line 604 "bc.y"
  1098.   { yyval.i_value = 0; }
  1099.   break;
  1100.   case 95:
  1101. ! #line 606 "bc.y"
  1102.   { yyval.i_value = 1; }
  1103.   break;
  1104.   case 96:
  1105. ! #line 608 "bc.y"
  1106.   { yyval.i_value = 2; }
  1107.   break;
  1108.   case 97:
  1109. ! #line 610 "bc.y"
  1110.   { yyval.i_value = 3; }
  1111.   break;
  1112. diff -c2 -r 1.01/bc.y 1.02/bc.y
  1113. *** 1.01/bc.y    Thu Feb  6 16:45:33 1992
  1114. --- 1.02/bc.y    Tue Mar  3 10:29:36 1992
  1115. ***************
  1116. *** 4,8 ****
  1117.   
  1118.   /*  This file is part of bc written for MINIX.
  1119. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1120.   
  1121.       This program is free software; you can redistribute it and/or modify
  1122. --- 4,8 ----
  1123.   
  1124.   /*  This file is part of bc written for MINIX.
  1125. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1126.   
  1127.       This program is free software; you can redistribute it and/or modify
  1128. ***************
  1129. *** 87,94 ****
  1130.   %type <a_value> opt_parameter_list opt_auto_define_list define_list
  1131.   %type <a_value> opt_argument_list argument_list
  1132. - %type <s_value> NAME STRING NUMBER
  1133.   %type <i_value> program input_item semicolon_list statement_list
  1134.   %type <i_value> statement function   statement_or_error
  1135. - %type <i_value> NEWLINE AND OR NOT
  1136.   
  1137.   /* precedence */
  1138. --- 87,92 ----
  1139. diff -c2 -r 1.01/bcdefs.h 1.02/bcdefs.h
  1140. *** 1.01/bcdefs.h    Thu Feb  6 16:45:27 1992
  1141. --- 1.02/bcdefs.h    Tue Mar  3 10:29:30 1992
  1142. ***************
  1143. *** 2,6 ****
  1144.   
  1145.   /*  This file is part of bc written for MINIX.
  1146. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1147.   
  1148.       This program is free software; you can redistribute it and/or modify
  1149. --- 2,6 ----
  1150.   
  1151.   /*  This file is part of bc written for MINIX.
  1152. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1153.   
  1154.       This program is free software; you can redistribute it and/or modify
  1155. diff -c2 -r 1.01/const.h 1.02/const.h
  1156. *** 1.01/const.h    Thu Feb  6 16:45:28 1992
  1157. --- 1.02/const.h    Tue Mar  3 10:29:31 1992
  1158. ***************
  1159. *** 2,6 ****
  1160.   
  1161.   /*  This file is part of bc written for MINIX.
  1162. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1163.   
  1164.       This program is free software; you can redistribute it and/or modify
  1165. --- 2,6 ----
  1166.   
  1167.   /*  This file is part of bc written for MINIX.
  1168. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1169.   
  1170.       This program is free software; you can redistribute it and/or modify
  1171. ***************
  1172. *** 39,43 ****
  1173.      POSIX constants. */
  1174.   
  1175. ! #define BC_BASE_MAX       999    /* No good reason for this value. */
  1176.   #define BC_SCALE_MAX  INT_MAX
  1177.   #define BC_STRING_MAX INT_MAX
  1178. --- 39,43 ----
  1179.      POSIX constants. */
  1180.   
  1181. ! #define BC_BASE_MAX   INT_MAX
  1182.   #define BC_SCALE_MAX  INT_MAX
  1183.   #define BC_STRING_MAX INT_MAX
  1184. ***************
  1185. *** 58,62 ****
  1186.   #define BC_LABEL_GROUP 64
  1187.   #define BC_LABEL_LOG    6
  1188. ! #define BC_MAX_SEGS    10    /* Code segments. */
  1189.   #define BC_SEG_SIZE  1024
  1190.   #define BC_SEG_LOG     10
  1191. --- 58,62 ----
  1192.   #define BC_LABEL_GROUP 64
  1193.   #define BC_LABEL_LOG    6
  1194. ! #define BC_MAX_SEGS    16    /* Code segments. */
  1195.   #define BC_SEG_SIZE  1024
  1196.   #define BC_SEG_LOG     10
  1197. diff -c2 -r 1.01/execute.c 1.02/execute.c
  1198. *** 1.01/execute.c    Thu Feb  6 16:45:38 1992
  1199. --- 1.02/execute.c    Tue Mar  3 10:29:41 1992
  1200. ***************
  1201. *** 2,6 ****
  1202.   
  1203.   /*  This file is part of bc written for MINIX.
  1204. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1205.   
  1206.       This program is free software; you can redistribute it and/or modify
  1207. --- 2,6 ----
  1208.   
  1209.   /*  This file is part of bc written for MINIX.
  1210. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1211.   
  1212.       This program is free software; you can redistribute it and/or modify
  1213. ***************
  1214. *** 29,42 ****
  1215.   #include "bcdefs.h"
  1216.   #include <signal.h>
  1217. - #include <setjmp.h>
  1218.   #include "global.h"
  1219.   #include "proto.h"
  1220.   
  1221. - /* Local variable for SIGINT interrupt of an execution. */
  1222. - static jmp_buf env;
  1223.   
  1224.   /* The SIGINT interrupt handling routine. */
  1225.   
  1226.   void
  1227.   stop_execution (sig)
  1228. --- 29,40 ----
  1229.   #include "bcdefs.h"
  1230.   #include <signal.h>
  1231.   #include "global.h"
  1232.   #include "proto.h"
  1233.   
  1234.   
  1235.   /* The SIGINT interrupt handling routine. */
  1236.   
  1237. + int had_sigint;
  1238.   void
  1239.   stop_execution (sig)
  1240. ***************
  1241. *** 43,49 ****
  1242.        int sig;
  1243.   {
  1244.     printf ("\n");
  1245.     rt_error ("interrupted execution");
  1246. -   longjmp (env, 1);     /* Jump to the main code. */
  1247.   }
  1248.   
  1249. --- 41,47 ----
  1250.        int sig;
  1251.   {
  1252. +   had_sigint = TRUE;
  1253.     printf ("\n");
  1254.     rt_error ("interrupted execution");
  1255.   }
  1256.   
  1257. ***************
  1258. *** 88,93 ****
  1259.     /* Set up the interrupt mechanism for an interactive session. */
  1260.     if (interactive)
  1261. !     if (setjmp (env) == 0)
  1262.         signal (SIGINT, stop_execution);
  1263.      
  1264.     while (pc.pc_addr < functions[pc.pc_func].f_code_size && !runtime_error)
  1265. --- 86,93 ----
  1266.     /* Set up the interrupt mechanism for an interactive session. */
  1267.     if (interactive)
  1268. !     {
  1269.         signal (SIGINT, stop_execution);
  1270. +       had_sigint = FALSE;
  1271. +     }
  1272.      
  1273.     while (pc.pc_addr < functions[pc.pc_func].f_code_size && !runtime_error)
  1274. ***************
  1275. *** 523,530 ****
  1276.       }
  1277.   
  1278. -   /* Clean up the interrupt stuff. */
  1279. -   if (interactive)
  1280. -     signal (SIGINT, use_quit);
  1281.     /* Clean up the function stack and pop all autos/parameters. */
  1282.     while (pc.pc_func != 0)
  1283. --- 523,526 ----
  1284. ***************
  1285. *** 540,543 ****
  1286. --- 536,546 ----
  1287.     while (ex_stack != NULL) pop();
  1288.   
  1289. +   /* Clean up the interrupt stuff. */
  1290. +   if (interactive)
  1291. +     {
  1292. +       signal (SIGINT, use_quit);
  1293. +       if (had_sigint)
  1294. +     printf ("Interruption completed.\n");
  1295. +     }
  1296.   }
  1297.   
  1298. diff -c2 -r 1.01/global.c 1.02/global.c
  1299. *** 1.01/global.c    Thu Feb  6 16:45:29 1992
  1300. --- 1.02/global.c    Tue Mar  3 10:29:32 1992
  1301. ***************
  1302. *** 2,6 ****
  1303.   
  1304.   /*  This file is part of bc written for MINIX.
  1305. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1306.   
  1307.       This program is free software; you can redistribute it and/or modify
  1308. --- 2,6 ----
  1309.   
  1310.   /*  This file is part of bc written for MINIX.
  1311. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1312.   
  1313.       This program is free software; you can redistribute it and/or modify
  1314. diff -c2 -r 1.01/global.h 1.02/global.h
  1315. *** 1.01/global.h    Thu Feb  6 16:45:30 1992
  1316. --- 1.02/global.h    Tue Mar  3 10:29:33 1992
  1317. ***************
  1318. *** 2,6 ****
  1319.   
  1320.   /*  This file is part of bc written for MINIX.
  1321. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1322.   
  1323.       This program is free software; you can redistribute it and/or modify
  1324. --- 2,6 ----
  1325.   
  1326.   /*  This file is part of bc written for MINIX.
  1327. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1328.   
  1329.       This program is free software; you can redistribute it and/or modify
  1330. diff -c2 -r 1.01/libmath.b 1.02/libmath.b
  1331. *** 1.01/libmath.b    Thu Feb  6 16:45:35 1992
  1332. --- 1.02/libmath.b    Tue Mar  3 10:29:37 1992
  1333. ***************
  1334. *** 2,6 ****
  1335.   
  1336.   /*  This file is part of bc written for MINIX.
  1337. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1338.   
  1339.       This program is free software; you can redistribute it and/or modify
  1340. --- 2,6 ----
  1341.   
  1342.   /*  This file is part of bc written for MINIX.
  1343. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1344.   
  1345.       This program is free software; you can redistribute it and/or modify
  1346. diff -c2 -r 1.01/load.c 1.02/load.c
  1347. *** 1.01/load.c    Thu Feb  6 16:45:35 1992
  1348. --- 1.02/load.c    Tue Mar  3 10:29:37 1992
  1349. ***************
  1350. *** 2,6 ****
  1351.   
  1352.   /*  This file is part of bc written for MINIX.
  1353. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1354.   
  1355.       This program is free software; you can redistribute it and/or modify
  1356. --- 2,6 ----
  1357.   
  1358.   /*  This file is part of bc written for MINIX.
  1359. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1360.   
  1361.       This program is free software; you can redistribute it and/or modify
  1362. ***************
  1363. *** 55,58 ****
  1364. --- 55,61 ----
  1365.     int seg, offset, func;
  1366.   
  1367. +   /* If there was an error, don't continue. */
  1368. +   if (had_error) return;
  1369.     /* Calculate the segment and offset. */
  1370.     seg = load_adr.pc_addr >> BC_SEG_LOG;
  1371. ***************
  1372. *** 60,63 ****
  1373. --- 63,72 ----
  1374.     func = load_adr.pc_func;
  1375.   
  1376. +   if (seg >= BC_MAX_SEGS)
  1377. +     {
  1378. +       yyerror ("Function too big.");
  1379. +       return;
  1380. +     }
  1381.     if (functions[func].f_body[seg] == NULL)
  1382.       functions[func].f_body[seg] = (char *) bc_malloc (BC_SEG_SIZE);
  1383. ***************
  1384. *** 153,156 ****
  1385. --- 162,168 ----
  1386.     while (*str != 0)
  1387.       {
  1388. +       /* If there was an error, don't continue. */
  1389. +       if (had_error) return;
  1390.         if (load_str)
  1391.       {
  1392. ***************
  1393. *** 249,254 ****
  1394.           
  1395.             case ']':  /* A function end */
  1396. !         if (!had_error) 
  1397. !           functions[load_adr.pc_func].f_defined = TRUE;
  1398.           load_adr = save_adr;
  1399.           break;
  1400. --- 261,265 ----
  1401.           
  1402.             case ']':  /* A function end */
  1403. !         functions[load_adr.pc_func].f_defined = TRUE;
  1404.           load_adr = save_adr;
  1405.           break;
  1406. diff -c2 -r 1.01/main.c 1.02/main.c
  1407. *** 1.01/main.c    Thu Feb  6 16:45:30 1992
  1408. --- 1.02/main.c    Tue Mar  3 10:29:33 1992
  1409. ***************
  1410. *** 2,6 ****
  1411.   
  1412.   /*  This file is part of bc written for MINIX.
  1413. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1414.   
  1415.       This program is free software; you can redistribute it and/or modify
  1416. --- 2,6 ----
  1417.   
  1418.   /*  This file is part of bc written for MINIX.
  1419. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1420.   
  1421.       This program is free software; you can redistribute it and/or modify
  1422. ***************
  1423. *** 128,132 ****
  1424.   
  1425.     /* Open the other files. */
  1426. !   if (use_math)
  1427.       {
  1428.   #ifdef BC_MATH_FILE
  1429. --- 128,132 ----
  1430.   
  1431.     /* Open the other files. */
  1432. !   if (use_math && first_file)
  1433.       {
  1434.   #ifdef BC_MATH_FILE
  1435. ***************
  1436. *** 138,142 ****
  1437.         new_yy_file (new_file);
  1438.         return TRUE;
  1439. !     }
  1440.         else
  1441.       {
  1442. --- 138,142 ----
  1443.         new_yy_file (new_file);
  1444.         return TRUE;
  1445. !     }    
  1446.         else
  1447.       {
  1448. diff -c2 -r 1.01/number.c 1.02/number.c
  1449. *** 1.01/number.c    Thu Feb  6 16:45:42 1992
  1450. --- 1.02/number.c    Tue Mar  3 10:29:45 1992
  1451. ***************
  1452. *** 2,6 ****
  1453.   
  1454.   /*  This file is part of bc written for MINIX.
  1455. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1456.   
  1457.       This program is free software; you can redistribute it and/or modify
  1458. --- 2,6 ----
  1459.   
  1460.   /*  This file is part of bc written for MINIX.
  1461. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1462.   
  1463.       This program is free software; you can redistribute it and/or modify
  1464. ***************
  1465. *** 1162,1166 ****
  1466.     int  index, fdigit, pre_space;
  1467.     stk_rec *digits, *temp;
  1468. !   bc_num int_part, frac_part, base, cur_dig, t_num;
  1469.   
  1470.     /* The negative sign if needed. */
  1471. --- 1162,1166 ----
  1472.     int  index, fdigit, pre_space;
  1473.     stk_rec *digits, *temp;
  1474. !   bc_num int_part, frac_part, base, cur_dig, t_num, max_o_digit;
  1475.   
  1476.     /* The negative sign if needed. */
  1477. ***************
  1478. *** 1200,1204 ****
  1479. --- 1200,1207 ----
  1480.       bc_sub (num, int_part, &frac_part);
  1481.       int2num (&base, o_base);
  1482. +     init_num (&max_o_digit);
  1483. +     int2num (&max_o_digit, o_base-1);
  1484.   
  1485.       /* Get the digits of the integer part and push them on a stack. */
  1486.       while (!is_zero (int_part))
  1487. ***************
  1488. *** 1224,1228 ****
  1489.             (*out_char) (ref_str[ (int) temp->digit]);
  1490.           else
  1491. !           out_long (temp->digit, base->n_len, 1, out_char);
  1492.           free (temp);
  1493.             }
  1494. --- 1227,1231 ----
  1495.             (*out_char) (ref_str[ (int) temp->digit]);
  1496.           else
  1497. !           out_long (temp->digit, max_o_digit->n_len, 1, out_char);
  1498.           free (temp);
  1499.             }
  1500. ***************
  1501. *** 1243,1247 ****
  1502.           (*out_char) (ref_str[fdigit]);
  1503.             else {
  1504. !         out_long (fdigit, base->n_len, pre_space, out_char);
  1505.           pre_space = 1;
  1506.             }
  1507. --- 1246,1250 ----
  1508.           (*out_char) (ref_str[fdigit]);
  1509.             else {
  1510. !         out_long (fdigit, max_o_digit->n_len, pre_space, out_char);
  1511.           pre_space = 1;
  1512.             }
  1513. diff -c2 -r 1.01/number.h 1.02/number.h
  1514. *** 1.01/number.h    Thu Feb  6 16:45:31 1992
  1515. --- 1.02/number.h    Tue Mar  3 10:29:34 1992
  1516. ***************
  1517. *** 2,6 ****
  1518.   
  1519.   /*  This file is part of bc written for MINIX.
  1520. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1521.   
  1522.       This program is free software; you can redistribute it and/or modify
  1523. --- 2,6 ----
  1524.   
  1525.   /*  This file is part of bc written for MINIX.
  1526. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1527.   
  1528.       This program is free software; you can redistribute it and/or modify
  1529. diff -c2 -r 1.01/proto.h 1.02/proto.h
  1530. *** 1.01/proto.h    Thu Feb  6 16:45:36 1992
  1531. --- 1.02/proto.h    Tue Mar  3 10:29:38 1992
  1532. ***************
  1533. *** 2,6 ****
  1534.   
  1535.   /*  This file is part of bc written for MINIX.
  1536. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1537.   
  1538.       This program is free software; you can redistribute it and/or modify
  1539. --- 2,6 ----
  1540.   
  1541.   /*  This file is part of bc written for MINIX.
  1542. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1543.   
  1544.       This program is free software; you can redistribute it and/or modify
  1545. diff -c2 -r 1.01/sbc.y 1.02/sbc.y
  1546. *** 1.01/sbc.y    Thu Feb  6 16:45:36 1992
  1547. --- 1.02/sbc.y    Tue Mar  3 10:29:38 1992
  1548. ***************
  1549. *** 3,7 ****
  1550.    
  1551.   /*  This file is part of bc written for MINIX.
  1552. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1553.   
  1554.       This program is free software; you can redistribute it and/or modify
  1555. --- 3,7 ----
  1556.    
  1557.   /*  This file is part of bc written for MINIX.
  1558. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1559.   
  1560.       This program is free software; you can redistribute it and/or modify
  1561. diff -c2 -r 1.01/scan.c.dist 1.02/scan.c.dist
  1562. *** 1.01/scan.c.dist    Thu Feb  6 16:45:44 1992
  1563. --- 1.02/scan.c.dist    Tue Mar  3 10:29:47 1992
  1564. ***************
  1565. *** 164,168 ****
  1566.   typedef struct yy_buffer_state *YY_BUFFER_STATE;
  1567.   
  1568. ! #define YY_CHAR char
  1569.   # line 1 "scan.l"
  1570.   #define INITIAL 0
  1571. --- 164,168 ----
  1572.   typedef struct yy_buffer_state *YY_BUFFER_STATE;
  1573.   
  1574. ! #define YY_CHAR unsigned char
  1575.   # line 1 "scan.l"
  1576.   #define INITIAL 0
  1577. ***************
  1578. *** 171,175 ****
  1579.   
  1580.   /*  This file is part of bc written for MINIX.
  1581. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1582.   
  1583.       This program is free software; you can redistribute it and/or modify
  1584. --- 171,175 ----
  1585.   
  1586.   /*  This file is part of bc written for MINIX.
  1587. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1588.   
  1589.       This program is free software; you can redistribute it and/or modify
  1590. ***************
  1591. *** 330,334 ****
  1592.       } ;
  1593.   
  1594. ! static const YY_CHAR yy_ec[128] =
  1595.       {   0,
  1596.           1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  1597. --- 330,334 ----
  1598.       } ;
  1599.   
  1600. ! static const YY_CHAR yy_ec[256] =
  1601.       {   0,
  1602.           1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  1603. ***************
  1604. *** 345,349 ****
  1605.          31,   32,   33,   34,   35,   36,   37,   38,   39,   40,
  1606.          41,   42,   43,   44,   45,   46,   47,   36,   48,   36,
  1607. !        49,   36,   50,   51,   52,    1,    1
  1608.       } ;
  1609.   
  1610. --- 345,363 ----
  1611.          31,   32,   33,   34,   35,   36,   37,   38,   39,   40,
  1612.          41,   42,   43,   44,   45,   46,   47,   36,   48,   36,
  1613. !        49,   36,   50,   51,   52,    1,    1,    1,    1,    1,
  1614. !         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  1615. !         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  1616. !         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  1617. !         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  1618. !         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  1619. !         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  1620. !         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  1621. !         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  1622. !         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  1623. !         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  1624. !         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  1625. !         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  1626. !         1,    1,    1,    1,    1
  1627.       } ;
  1628.   
  1629. ***************
  1630. *** 761,768 ****
  1631.   # line 130 "scan.l"
  1632.   {
  1633. !            char *look;
  1634.             yylval.s_value = strcopyof(yytext);
  1635.             for (look = yytext; *look != 0; look++)
  1636. !         if (*look == '\n') line_no++;
  1637.             return(STRING);
  1638.           }
  1639. --- 775,787 ----
  1640.   # line 130 "scan.l"
  1641.   {
  1642. !            unsigned char *look;
  1643. !           int count = 0;
  1644.             yylval.s_value = strcopyof(yytext);
  1645.             for (look = yytext; *look != 0; look++)
  1646. !         {
  1647. !           if (*look == '\n') line_no++;
  1648. !           if (*look == '"')  count++;
  1649. !         }
  1650. !           if (count != 2) yyerror ("NUL character in string.");
  1651.             return(STRING);
  1652.           }
  1653. ***************
  1654. *** 769,775 ****
  1655.       YY_BREAK
  1656.   case 37:
  1657. ! # line 137 "scan.l"
  1658.   {
  1659. !           char *src, *dst;
  1660.             int len;
  1661.             /* remove a trailing decimal point. */
  1662. --- 788,794 ----
  1663.       YY_BREAK
  1664.   case 37:
  1665. ! # line 142 "scan.l"
  1666.   {
  1667. !           unsigned char *src, *dst;
  1668.             int len;
  1669.             /* remove a trailing decimal point. */
  1670. ***************
  1671. *** 799,807 ****
  1672.       YY_BREAK
  1673.   case 38:
  1674. ! # line 164 "scan.l"
  1675. ! yyerror ("illegal character: %s",yytext);
  1676.       YY_BREAK
  1677.   case 39:
  1678. ! # line 165 "scan.l"
  1679.   ECHO;
  1680.       YY_BREAK
  1681. --- 818,834 ----
  1682.       YY_BREAK
  1683.   case 38:
  1684. ! # line 169 "scan.l"
  1685. ! {
  1686. !       if (yytext[0] < ' ')
  1687. !         yyerror ("illegal character: ^%c",yytext[0] + '@');
  1688. !       else
  1689. !         if (yytext[0] > '~')
  1690. !           yyerror ("illegal character: \\%3d", (int) yytext[0]);
  1691. !         else
  1692. !           yyerror ("illegal character: %s",yytext);
  1693. !     }
  1694.       YY_BREAK
  1695.   case 39:
  1696. ! # line 178 "scan.l"
  1697.   ECHO;
  1698.       YY_BREAK
  1699. ***************
  1700. *** 1073,1077 ****
  1701.       }
  1702.       yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1703. !     yy_is_jam = (yy_base[yy_current_state] == 194);
  1704.   
  1705.       return ( yy_is_jam ? 0 : yy_current_state );
  1706. --- 1100,1104 ----
  1707.       }
  1708.       yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1709. !     yy_is_jam = (yy_current_state == 143);
  1710.   
  1711.       return ( yy_is_jam ? 0 : yy_current_state );
  1712. ***************
  1713. *** 1327,1331 ****
  1714.       b->yy_eof_status = EOF_NOT_SEEN;
  1715.       }
  1716. ! # line 165 "scan.l"
  1717.   
  1718.   
  1719. --- 1354,1358 ----
  1720.       b->yy_eof_status = EOF_NOT_SEEN;
  1721.       }
  1722. ! # line 178 "scan.l"
  1723.   
  1724.   
  1725. diff -c2 -r 1.01/scan.l 1.02/scan.l
  1726. *** 1.01/scan.l    Thu Feb  6 16:45:31 1992
  1727. --- 1.02/scan.l    Tue Mar  3 10:29:39 1992
  1728. ***************
  1729. *** 3,7 ****
  1730.   
  1731.   /*  This file is part of bc written for MINIX.
  1732. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1733.   
  1734.       This program is free software; you can redistribute it and/or modify
  1735. --- 3,7 ----
  1736.   
  1737.   /*  This file is part of bc written for MINIX.
  1738. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1739.   
  1740.       This program is free software; you can redistribute it and/or modify
  1741. ***************
  1742. *** 129,140 ****
  1743.   [a-z][a-z0-9_]* { yylval.s_value = strcopyof(yytext); return(NAME); }
  1744.   \"[^\"]*\"  {
  1745. !            char *look;
  1746.             yylval.s_value = strcopyof(yytext);
  1747.             for (look = yytext; *look != 0; look++)
  1748. !         if (*look == '\n') line_no++;
  1749.             return(STRING);
  1750.           }
  1751.   {DIGIT}({DIGIT}|\\\n)*("."({DIGIT}|\\\n)*)?|"."(\\\n)*{DIGIT}({DIGIT}|\\\n)* {
  1752. !           char *src, *dst;
  1753.             int len;
  1754.             /* remove a trailing decimal point. */
  1755. --- 129,145 ----
  1756.   [a-z][a-z0-9_]* { yylval.s_value = strcopyof(yytext); return(NAME); }
  1757.   \"[^\"]*\"  {
  1758. !            unsigned char *look;
  1759. !           int count = 0;
  1760.             yylval.s_value = strcopyof(yytext);
  1761.             for (look = yytext; *look != 0; look++)
  1762. !         {
  1763. !           if (*look == '\n') line_no++;
  1764. !           if (*look == '"')  count++;
  1765. !         }
  1766. !           if (count != 2) yyerror ("NUL character in string.");
  1767.             return(STRING);
  1768.           }
  1769.   {DIGIT}({DIGIT}|\\\n)*("."({DIGIT}|\\\n)*)?|"."(\\\n)*{DIGIT}({DIGIT}|\\\n)* {
  1770. !           unsigned char *src, *dst;
  1771.             int len;
  1772.             /* remove a trailing decimal point. */
  1773. ***************
  1774. *** 162,166 ****
  1775.             return(NUMBER);
  1776.           }
  1777. ! .       yyerror ("illegal character: %s",yytext);
  1778.   %%
  1779.   
  1780. --- 167,179 ----
  1781.             return(NUMBER);
  1782.           }
  1783. ! .       {
  1784. !       if (yytext[0] < ' ')
  1785. !         yyerror ("illegal character: ^%c",yytext[0] + '@');
  1786. !       else
  1787. !         if (yytext[0] > '~')
  1788. !           yyerror ("illegal character: \\%3d", (int) yytext[0]);
  1789. !         else
  1790. !           yyerror ("illegal character: %s",yytext);
  1791. !     }
  1792.   %%
  1793.   
  1794. diff -c2 -r 1.01/storage.c 1.02/storage.c
  1795. *** 1.01/storage.c    Thu Feb  6 16:45:41 1992
  1796. --- 1.02/storage.c    Tue Mar  3 10:29:44 1992
  1797. ***************
  1798. *** 2,6 ****
  1799.   
  1800.   /*  This file is part of bc written for MINIX.
  1801. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1802.   
  1803.       This program is free software; you can redistribute it and/or modify
  1804. --- 2,6 ----
  1805.   
  1806.   /*  This file is part of bc written for MINIX.
  1807. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1808.   
  1809.       This program is free software; you can redistribute it and/or modify
  1810. diff -c2 -r 1.01/util.c 1.02/util.c
  1811. *** 1.01/util.c    Thu Feb  6 16:45:39 1992
  1812. --- 1.02/util.c    Tue Mar  3 10:29:42 1992
  1813. ***************
  1814. *** 2,6 ****
  1815.   
  1816.   /*  This file is part of bc written for MINIX.
  1817. !     Copyright (C) 1991 Free Software Foundation, Inc.
  1818.   
  1819.       This program is free software; you can redistribute it and/or modify
  1820. --- 2,6 ----
  1821.   
  1822.   /*  This file is part of bc written for MINIX.
  1823. !     Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  1824.   
  1825.       This program is free software; you can redistribute it and/or modify
  1826. diff -c2 -r 1.01/version.h 1.02/version.h
  1827. *** 1.01/version.h    Thu Feb  6 16:45:32 1992
  1828. --- 1.02/version.h    Tue Mar  3 10:29:34 1992
  1829. ***************
  1830. *** 1,3 ****
  1831.   #define BC_VERSION  \
  1832. !   "bc 1.01 (Nov 25, 1991), Copyright (C) 1991 Free Software Foundation, Inc."
  1833.   
  1834. --- 1,3 ----
  1835.   #define BC_VERSION  \
  1836. !  "bc 1.02 (Mar 3, 92) Copyright (C) 1991, 1992 Free Software Foundation, Inc."
  1837.   
  1838. exit 0 # Just in case...
  1839.